Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Drawing
Imports System.Data
Imports System.Linq
Imports System.Text
Imports System.Windows.Forms
Imports C4F.DevKit.WebServices
Imports C4F.DevKit.WebServices.Datasets
Imports System.IO


Namespace C4F.DevKit.WebServicesDemo
	Public Partial Class YahooTrafficControl
		Inherits UserControl
		Public Sub New()
			InitializeComponent()
		End Sub

		Private Sub GoButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles GoButton.Click
            Try
                YahooTrafficService.ApplicationKey = ApplicationKey.Text
                YahooTrafficResults = YahooTrafficService.GetTraffic_DS(SearchLocation.Text)
                YahooTrafficGrid.DataSource = YahooTrafficResults.TrafficIncident
            Catch ex As System.Net.WebException
                Dim streamReader As StreamReader = New StreamReader(ex.Response.GetResponseStream())
                Dim responseData As String = streamReader.ReadToEnd()
                streamReader.Close()
                MessageBox.Show(responseData)
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
		End Sub

	End Class
End Namespace
